package com.bwie.mapper;

import com.bwie.common.domain.GroupActivity;
import com.bwie.common.domain.GroupOrder;
import com.bwie.common.domain.GroupSession;
import com.bwie.common.domain.Product;
import com.bwie.common.domain.request.ActivityRequest;
import com.bwie.common.domain.response.ActivityProductListResponse;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @className: ActivityMapper
 * @Description: TODO
 * @version: v1.８.0
 * @author: 刘茂锴
 * @date: 2025/10/2 11:16
 */
public interface ActivityMapper {
    //拼团列表
    List<ActivityProductListResponse> activityList(ActivityRequest activityRequest);

    //商品下拉框
    List<Product> productList();

    //添加拼团活动
    void activityAdd(GroupActivity groupActivity);

    //查询用户发起拼团的数量
    int selectUserIdAndActivity(Integer userId);

    //根据拼团id查询拼团
    GroupActivity selectActivity(Integer activityId);

    //根据拼团id查询会话
    GroupSession selectGroupSession(Integer activityId);

    //创建订单
    void groupOrderAdd(GroupOrder groupOrder);


    //更新团会话当前人数
    void updateGroupSessionCurrentSize(@Param("groupSessionId") Integer groupSessionId, @Param("currentSize") Integer currentSize);

    //更新团会话状态
    void updateGroupSessionStatus(@Param("groupSessionId") Integer groupSessionId, @Param("status") Integer status);

    //查询用户在指定团会话中是否已参团
    int selectUserInGroupSession(@Param("userId") Integer userId, @Param("groupSessionId") Integer groupSessionId);

    //查询团会话当前参团人数
    int selectGroupSessionCurrentSize(Integer groupSessionId);

    //一个团只能参加一次
    int selectUserActivity(@Param("userId") Integer userId, @Param("activityId") Integer activityId);

    //更改拼团活动状态
    void updStatus(@Param("activityId") Integer activityId, @Param("jie") Integer jie);

    //查询所有正在拼团的
    List<GroupActivity> selectActivityStatus();
}
